package com.example.aqarapp.view.adapter;

import android.view.View;
import android.widget.ImageView;
import android.widget.Toast;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.List;

import aqarapp.R;

public class BulbScenesRecyclerAdapter extends BaseQuickAdapter<String, BaseViewHolder> {
    private ImageView sceneIV;

    public BulbScenesRecyclerAdapter(int layoutResId, @Nullable List<String> data) {
        super(layoutResId, data);
    }

    public BulbScenesRecyclerAdapter(int layoutResId) {
        super(layoutResId);
    }

    @Override
    protected void convert(@NotNull final BaseViewHolder baseViewHolder, String s) {
        baseViewHolder.setText(R.id.bulb_scene_type_text, s);
        sceneIV = baseViewHolder.getView(R.id.bulb_scene_type_image);
        //todo 设置imageView 的背景图
        sceneIV.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(getContext(), "你选中了sceneIV" + (baseViewHolder.getAdapterPosition() + 1), Toast.LENGTH_SHORT).show();
            }
        });
    }
}
